from odoo import fields, models, api


class OperatingStatementsSettings(models.Model):
    _name = 's.operating.statements.settings'
    _description = 'Operating Statements Settings'

    year = fields.Char('Year', copy=False, required=True)
    month = fields.Char('Month', copy=False, required=True)
    sales_value = fields.Float('sales value', copy=False)  # 销售产值
    sales_return_value = fields.Float('sales return value', copy=False)  # 退货扣减价值
    return_inspection_and_storage_value = fields.Float('Return inspection and storage', copy=False)  # 返检入库增加价值
    customer_quality_deduction_value = fields.Float('customer quality deduction', copy=False)  # 客户品质扣款
    finished_goods_warehouse_loss_deduction_value = fields.Float(string='finished goods warehouse loss deduction', copy=False)  # 成品仓盘亏扣减价值
    single_process_processing_income = fields.Float(string='single process processing income', copy=False)  # 单工序加工收入
    single_process_processing_compensation = fields.Float(string='single process processing compensation', copy=False)  # 单工序加工赔偿
    other_business_income_scrap_income = fields.Float(string='other business income scrap income', copy=False)  # 其他业务收入-废料收入
    raw_materials_plate = fields.Float(string='raw materials plate', copy=False)  # 原材料-板料
    raw_materials_prepreg = fields.Float(string='raw materials prepreg', copy=False)  # 原材料-半固化片
    raw_materials_copper_foil = fields.Float(string='raw materials copper foil', copy=False)  # 原材料-铜箔
    raw_materials_ink = fields.Float(string='raw materials ink', copy=False)  # 原材料-油墨
    raw_materials_dry_film = fields.Float(string='raw materials dry film', copy=False)  # 原材料-干膜
    components_and_copper_blocks = fields.Float(string='components and copper blocks', copy=False)  # 器件&铜块
    raw_materials_copper_balls_copper_powder = fields.Float(string='raw materials copper balls copper powder', copy=False)  # 原材料-铜球，氧化铜粉
    raw_materials_tin_balls_tin_bars_nickel_blocks = fields.Float(string='raw materials tin balls tin bars nickel blocks', copy=False)  # 原材料-锡球，锡条，镍块
    raw_materials_potassium_gold_cyanide = fields.Float(string='raw materials potassium gold cyanide', copy=False)  # 原材料-氰化亚金钾
    raw_materials_packaging_wire = fields.Float(string='raw materials packaging wire', copy=False)  # 原材料-包线
    raw_materials_drill_bits_routing_bits_slotting_bits = fields.Float(string='raw materials drill bits routing bits slotting bits', copy=False)  # 原材料-钻咀、锣刀、槽刀
    other_materials = fields.Float(string='other materials', copy=False)  # 其它物料
    basic_chemicals = fields.Float(string='basic chemicals', copy=False)  # 基础药水
    packaging_wire_chemical_costs = fields.Float(string='packaging wire chemical costs', copy=False)  # 包线药水费用
    single_process_outsourcing = fields.Float(string='single process outsourcing', copy=False)  # 单制程外包
    full_process_outsourcing = fields.Float(string='full process outsourcing', copy=False)  # 全制程外包

    @api.depends('year', 'month')
    def _compute_display_name(self):
        for rec in self:
            rec.display_name = f"{rec.year} - {rec.month}"
